export type themeType = 'light' | 'dark'
// 主题配置对象
const themes = {
	light: {
		bgColor: '#fff',
		textColor: '#000',
		boderColor: '#e5e5e5'
	},
	dark: {
		bgColor: '#585858ff',
		textColor: '#ffffffff',
		boderColor: '#9c9c9cff'
	}
}
// 获取本地存储的主题色
export const getLocalTheme = (): themeType => {
	return (localStorage.getItem('theme') as themeType) || 'light'
}
// 保存主题色
export const saveTheme = (theme: themeType) => {
	localStorage.setItem('theme', theme)
}
// 切换 主题色
export const ChangeTheme = (theme: themeType) => {
	const comfig = themes[theme]
	const root = document.documentElement;
	// console.log(comfig.bgColor)
	root.style.setProperty('--bg-color', comfig.bgColor)
	root.style.setProperty('--text-color', comfig.textColor)
	root.style.setProperty('--border-color', comfig.boderColor)
}